import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QrAnswerVO, QrAnswerForm, QrAnswerQuery } from '@/api/stroke/qrAnswer/types';

/**
 * 查询QR风险测算问卷答案列表
 * @param query
 * @returns {*}
 */

export const listQrAnswer = (query?: QrAnswerQuery): AxiosPromise<QrAnswerVO[]> => {
  return request({
    url: '/stroke/qrAnswer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询QR风险测算问卷答案详细
 * @param id
 */
export const getQrAnswer = (id: string | number): AxiosPromise<QrAnswerVO> => {
  return request({
    url: '/stroke/qrAnswer/' + id,
    method: 'get'
  });
};

/**
 * 新增QR风险测算问卷答案
 * @param data
 */
export const addQrAnswer = (data: QrAnswerForm) => {
  return request({
    url: '/stroke/qrAnswer',
    method: 'post',
    data: data
  });
};

/**
 * 修改QR风险测算问卷答案
 * @param data
 */
export const updateQrAnswer = (data: QrAnswerForm) => {
  return request({
    url: '/stroke/qrAnswer',
    method: 'put',
    data: data
  });
};

/**
 * 删除QR风险测算问卷答案
 * @param id
 */
export const delQrAnswer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/qrAnswer/' + id,
    method: 'delete'
  });
};
